//
//  GFWebViewController.m
//  GeneralFramework
//
//  Created by 郑浩然 on 2019/7/1.
//  Copyright © 2019年 郑然. All rights reserved.
//

#import "GFWebViewController.h"

@interface GFWebViewController ()<UIWebViewDelegate>
@property (weak, nonatomic) IBOutlet UIWebView *webView;

@end

@implementation GFWebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    _webView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
    self.urlStr =  [self.urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.urlStr]];
    
    [self.webView loadRequest:request];
    [_webView setScalesPageToFit:YES];
    _webView.delegate = self;
    
}
//加载完成
- (void)webViewDidFinishLoad:(UIWebView *)webView {
    [MBProgressHUD mj_hideHUDForView:self.view];
    // 获取当前页面的title
    self.title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"];
}
- (void)webViewDidStartLoad:(UIWebView *)webView {
    [MBProgressHUD mj_showMessage:nil toView:self.view];
}
- (IBAction)backBtnClick:(id)sender {
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
